<div class="row row-cards row-deck">
  <div class="col-12">
    <div class="card">
      <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
        <thead>
          <tr>
            <th>供求</th>
            <th>商品名字</th>
            <th>价格</th>
            <th>地区</th>
            <th>状态</th>
            <th class="text-center"><i class="icon-settings"></i></th>
          </tr>
        </thead>
        <tbody>
          <% @topics.each do |topic| %>
          <tr>
            <td>
              <div>
                <%= topic.sale_or_buy == 'sale' ? "供" : "求" %>
              </div>
            </td>
            <td>
              <div><%= topic.name %></div>
              <div class="small text-muted">
                <%= formattime(topic.created_at, unit: "hour") %>
              </div>
            </td>
            <td>
              <div>
                <%= topic.price %>
              </div>
            </td>
            <td>
              <div>
                <%= topic.province.name %><%= topic.city.name %><%= topic.district.name %>
              </div>
            </td>
            <td>
              <div>
                <%= i18n_enum topic, :state %>
              </div>
            </td>
            <td class="text-center">
              <div class="item-action dropdown">
                <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
                <div class="dropdown-menu dropdown-menu-right">
                  <a href="<%= edit_admin_topic_path(topic) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 查看 </a>
                  <%= link_to admin_topic_path(topic), method: :delete, class: 'dropdown-item' do %>
                    <i class="dropdown-icon fe fe-edit-2"></i> 删除 
                  <% end %>
                </div>
              </div>
            </td>
          </tr>
          <% end %>
        </tbody>
      </table>
      <div class="card-footer">
        <%= paginate @topics %>
      </div>
    </div>
  </div>
</div>